This repository was archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Add library function for copying directory #59
Merged
farshidtz
merged 7 commits into
canonical:main
from
MonicaisHer:EDGEX-453-add-copyDir-func
Jun 20, 2022
Merged
Add library function for copying directory #59
farshidtz
merged 7 commits into
canonical:main
from
MonicaisHer:EDGEX-453-add-copyDir-func
Jun 20, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cb9d9f5
to
785c725
Compare
785c725
to
5c24ded
Compare
6 tasks
farshidtz
approved these changes
Jun 20, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the new functions. There are some issues in tests which we should address later on.
Comment on lines
+151
to
+174
func TestCopyFile(t *testing.T) { | ||
tmpdir := t.TempDir() | ||
tmpfile, _ := os.CreateTemp(tmpdir, "tmpSrcFile") | ||
srcPath := tmpfile.Name() | ||
|
||
tmpdir = t.TempDir() | ||
tmpfile, _ = os.CreateTemp(tmpdir, "tmpDstFile") | ||
dstPath := tmpfile.Name() | ||
|
||
require.NoError(t, CopyFile(srcPath, dstPath), "Error copying file.") | ||
} | ||
|
||
func TestCopyDir(t *testing.T) { | ||
tmpdir := t.TempDir() | ||
tmpSrcDir, _ := os.MkdirTemp(tmpdir, "tmpSrcDir") | ||
os.CreateTemp(tmpSrcDir, "tmpSrcFile1") | ||
os.CreateTemp(tmpSrcDir, "tmpSrcFile2") | ||
os.CreateTemp(tmpSrcDir, "tmpSrcFile3") | ||
|
||
tmpdir = t.TempDir() | ||
tmpDstDir, _ := os.MkdirTemp(tmpdir, "tmpDstDir") | ||
|
||
require.NoError(t, CopyDir(tmpSrcDir, tmpDstDir), "Error copying directory.") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests should have better coverage for permissions. Also, all errors during the mocking are ignored.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolves #57